package com.briup.es.web;

import com.briup.es.config.response.Result;
import com.briup.es.domain.vo.CategoryVO;
import com.briup.es.service.CategoryService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/category")
@RequiredArgsConstructor
public class CategoryController {

    private final CategoryService categoryService;

    /**
     * 首页获取全部分类，带子类
     * @return Result<List<CategoryVO>>
     */
    @GetMapping("/list")
    public Result<List<CategoryVO>> list(){
        List<CategoryVO> categoryVOS = categoryService.queryAll();
        return Result.success(categoryVOS);
    }
}
